import { Entity, PrimaryGeneratedColumn, Column, OneToMany, CreateDateColumn, ManyToOne } from 'typeorm';
import { Post } from './Post';
import { User } from './User'
import { Shop } from './Shop'
@Entity()
export class Comment {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({ type: 'text' })
    content: string;

    @CreateDateColumn()
    createdDate: Date;

    @ManyToOne(() => Post, (post) => post.comments)
    post: Post;

    @Column({ nullable: true })
    postId: string;

    @ManyToOne(() => User, (user) => user.comments)
    user: User;

    @Column({ nullable: true })
    userId: string;

    @ManyToOne(() => Shop, (shop) => shop.comments)
    shop: Shop;

    @Column({ nullable: true })
    shopId: string;

}
